function changeThis(obj) {
    let url = $(obj).attr("data-url");
    if (url === undefined) {
        url = location.pathname;
    }
    let sb = "?";
    $.each(obj.attributes, function (_index, attribute) {
        if (attribute.name.substring(0, 9) === "data-get-") {
            let oname = attribute.name.substring(9);
            let ovalue = $(attribute.value).val();
            if (ovalue !== '') {
                sb = sb + oname + "=" + ovalue + "&";
            }
        }
    });
    if (sb.length > 1) {
        sb = sb.substr(0, sb.length - 1);
        url = url + sb;
    }
    skip(url);
}

/**
 * show-image.js
 */
function showBox(id) {
	$(document).on('click', id, function (event) {
        event.preventDefault();
        let isImage = $(this).attr("data-is-image");
		if (isImage == 'true') {
	        $(this).ekkoLightbox({});
		} else {
			skip($(this).attr("href"), "_blank")
		}
    });
}
function showImage(id) {
	let html = '<img class="d-none clearfix" id="image-window" style="width: 30%; height: auto;" autofocus="autofocus">';
	$("body").children(":last").after(html);
	
	var ih = -1;
	var iw = -1;
	$(id)
	.click(function () {
		skip($(this).attr("href"), "_blank")
	})
	.mouseenter(function(){
		let isImage = $(this).attr("data-is-image");
		if (isImage != 'true') {
			return;
		}
		let productImg = $(this).attr("href");
        if (productImg == "undefined" || productImg == null || productImg == "") {
            return;
        }
        $("#image-window").attr("src", productImg).attr("class","");
	})
	.mousemove(function(){
		let isImage = $(this).attr("data-is-image");
		if (isImage != 'true') {
			return;
		}
		if (ih == -1) {
			let ihTemp = $("#image-window").height();
			if (ihTemp != 0) {
				let wh = $(window).height();
		        let ww = $(window).width();
		        
		        ih = $("#image-window").height();
		        iw = $("#image-window").width();
		        
		        let x = (ww-iw)/2 + 1;
		        let y = (wh-ih)/2 + 1;
		        
		        $("#image-window").css("position", "absolute").css("left", x+"px").css("top", y+"px");
			}
		}
	})
	.mouseleave(function () {
		let isImage = $(this).attr("data-is-image");
		if (isImage != 'true') {
			return;
		}
	    $("#image-window").attr("src", "").attr("class","d-none").css("position", "absolute").css("left", "-400px").css("top", "-400px");
	    ih = -1;
	    iw = -1;
	});
	
}